﻿
@{
    ViewBag.Title = "SysUserManageIndex";
    Layout = "~/Views/Shared/_LayoutEmbeddedFrame.cshtml";
}
@model CNDreams.Web.Models.ModelTreePageUTOrgDepartmentManageIndex
<style type="text/css">
	#tree
	{
		float: left;
		height:100%;
		margin:1px 0 0 0;
		width: 200px;
		background: url("/Content/images/treebg.jpg") no-repeat scroll 0 0 #FFFFFF;
		padding:10px 0 0 0;
	}
</style>
<script type="text/javascript">
    $(function () {
        $("#tree").height($("html").height());

        /* 初始化树
        ----------------------------------------------------------*/
        var tree = $("#tree").jstree({
            "types": {
                "valid_children": ["root"],
                "types": {
                    "root": {
                        "icon": {
                            "image": "/Content/images/ico0.jpg"
                        },
                        "valid_children": ["default"],
                        "max_depth": 2,
                        "hover_node": false,
                        "select_node": function () { }
                    },
                    "default": {
                        "valid_children": ["default"],
                        "icon": {
                            "image": "/Content/images/ico1.jpg"
                        }
                    },
                    "renter": {
                        "icon": {
                            "image": "/Content/images/ico4.jpg"
                        }
                    },
                    "businessman": {
                        "icon": {
                            "image": "/Content/images/ico4.jpg"
                        }
                    }
                }
            },
            "plugins": ["themes", "html_data", "ui", "types"]
        });
        tree.bind("loaded.jstree", function (event, data) {
            tree.jstree("open_all");
        });

    });

    function setFrameUrl(url) {
        $("#embeddedFrame").attr("src", url);
    }
	</script>
	<div id="tree">
    
	<ul> 
     @foreach (var item in Model.UTOrganizationCollection)
     {
                 <li rel="root">
				<a href="javascript:void(0)" onclick="setFrameUrl('/ModuleSys/SysUserManage/Index/?organizationId=@item.ID')">@item.Name</a>
                 
            <ul>
			 @foreach (var item2 in Model.UTOrgDepartmentCollection.Where(x => x.OrganizationID == item.ID))
    {
	
					<li>
						<a href="javascript:void(0)" onclick="setFrameUrl('/ModuleSys/SysUserManage/Index/?departmentId=@item2.ID')">@item2.DepartmentName</a>
					</li>
    }
			</ul>  
		</li>
          
     }
	</ul>
</div>